﻿using System;
using System.Runtime.InteropServices;

namespace Gmantis.Controls
{
    [StructLayout(LayoutKind.Sequential)]
    public struct AnchorMatching
    {
        public Anchor FixedElementAnchor { get; set; }
        public Anchor MoveableElementAnchor { get; set; }
        public override bool Equals(object obj)
        {
            AnchorMatching matching = (AnchorMatching)obj;
            return ((matching.FixedElementAnchor == this.FixedElementAnchor) && (matching.MoveableElementAnchor == this.MoveableElementAnchor));
        }

        public override int GetHashCode()
        {
            return (this.FixedElementAnchor.GetHashCode() | this.MoveableElementAnchor.GetHashCode());
        }

        public static bool operator ==(AnchorMatching am1, AnchorMatching am2)
        {
            return am1.Equals(am2);
        }

        public static bool operator !=(AnchorMatching am1, AnchorMatching am2)
        {
            return (am1 != am2);
        }
    }

    public enum Anchor
    {
        TopLeft,
        TopRight,
        BottomLeft,
        BottomRight,
        Center
    }
}
